const express = require('express')
// 创建路由对象
const router = express.Router()
// 导入验证数据的中间件
const expressJoi = require('@escook/express-joi')
// 导入文章分类的验证模块
const { add_cate_schema,del_cate_schema,get_cate_schema,update_cate_schema } = require('../schema/artcates')
const artcateRouterHandler =  require('../router_handler/artcate')
// 获取文章分类列表
router.get('/cates',artcateRouterHandler.getArtCates)
// 添加文章分类
router.post('/addcates',expressJoi(add_cate_schema), artcateRouterHandler.addArtCates)
// 根据id删除文章分类
router.post('/delcates/:id',expressJoi(del_cate_schema),artcateRouterHandler.delArtCates)
// 根据id获取文章分类
router.get('/getcate',expressJoi(get_cate_schema),artcateRouterHandler.getArtCateById)
// 根据id更新文章分类
router.post('/updatecate',expressJoi(update_cate_schema),artcateRouterHandler.updateArtCateById)

module.exports = router